package isanfeng.tuxiaoer.pattern.creational.Esingleton;

/**
 * 保证每一个线程，拿到相同的对象
 * @author 李红辉
 * @version 1.0
 * @date 2019/10/12 14:16
 */
public class ThreadLocalInstance {

    private static final ThreadLocal<ThreadLocalInstance> threadLocal = ThreadLocal.withInitial(() -> new ThreadLocalInstance());

    private ThreadLocalInstance() {

    }

    public static ThreadLocalInstance getInstance() {
        return threadLocal.get();
    }

}
